<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>公告设置</title>
  <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
</head>
<body class="layui-layout-body" >
<div class="layui-layout layui-layout-admin">

<div class="layui-body">
	
	<blockquote class="layui-elem-quote" th:text="${msg}" th:style="'color: green;display:' + (${msg} == null ? 'none' : 'block')"></blockquote>
	
	<form class="layui-form" th:action="@{/index_page/channel_notice_config/save}" method="post">
		<input type="hidden" name="channelId" th:value="${channelId}">
		<div class="layui-form-item">
	    	<label class="layui-form-label" style="width: 100px">是否开启公告</label>
	    	<div class="layui-input-block">
		      	<input type="radio" name="status" value="1" title="是" th:checked="${config == null} ? false : ${config.status == 1}">
		      	<input type="radio" name="status" value="0" title="否" th:checked="${config == null} ? true : ${config.status == 0}">
	    	</div>
	  	</div>
  		<div class="layui-form-item">
      		<label class="layui-form-label" style="width: 100px"><span style="color: red;">*</span>轮播时间间隔</label>
      		<div class="layui-input-inline">
      			<input id="carouselInterval" name="carouselInterval" class="layui-input" type="text" placeholder="请输入" autocomplete="off" lay-verify="carouselInterval"
      				th:value="${config == null} ? '' : ${config.carouselInterval}">
      			
     		</div>
     		<div class="layui-form-mid">s</div>
  		</div>
  		<div class="layui-form-item">
  			<label class="layui-form-label" style="width: 100px"></label>
  			<div class="layui-input-inline layui-form-mid layui-word-aux">
		    	请输入1～3600的整数
		    </div>
  		</div>
		<div class="layui-form-item">
    		<div class="layui-input-block">
      			<button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
    		</div>
  		</div>
	</form>
	
	<div style="height: 70px"></div>
</div>
  
</div>
<script th:src="@{/layui/jquery.min.js}"></script>
<script th:src="@{/layui/layui.js}"></script>
<script>
$(document).ready(function(){ 
	$(".layui-body").css({"left": "10px","top": "10px"});
}); 
//一般直接写在一个js文件中
var form;
layui.use(['layer', 'form'], function(){
	var layer = layui.layer;
	form = layui.form;

	form.verify({
		carouselInterval: function(value, item) {
			var patrn = /^[1-9][0-9]{0,3}$/;
		  	if (!patrn.test(value) || value > 3600) {
		  		return '请输入1～3600的整数';
		  	}
		  	
			/* var val=$('input:radio[name="status"]:checked').val();
			if(val == 1) {
				if(value == null)
					return '轮播间隔不能为空';
				if(!value.match(/^[1-9]\d*$/)) 
					return '请输入大于0的整数';
			} */
		}
	});
});

</script>
</body>
</html>